/*
 * @Author: Leo.wang wanglizhigs@163.com
 * @Date: 2024-05-06 08:47:12
 * @LastEditors: Leo.wang wanglizhigs@163.com
 * @LastEditTime: 2024-05-10 23:15:24
 * @FilePath: /gptfront-dev/vite.config.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig, loadEnv } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import { UnifiedViteWeappTailwindcssPlugin as uvwt } from 'weapp-tailwindcss/vite'



export default ({ mode }) => {
    process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }

    return defineConfig({
        plugins: [
            uni(),
            process.env.VITE_APP_PLATFORM !== 'h5' && uvwt({ rem2rpx: true }),
            
        ],
        css: {
            postcss: {
                plugins: [require('tailwindcss'), require('autoprefixer')],
            },
        },
        server: {
            proxy: {
                '/api': {
                    target: 'http://www.chatsmart.tech',
                    changeOrigin: true,
                    secure: false,
                    ws: false,
                    rewrite: (path) => {
                        console.log('path', path)
                        return path
                    },
                },
            },
        },
    })
}
